// web/src/api/frontend/wechat/index.ts

import createAxios from '/@/utils/axios'

/**
 * 获取微信登录二维码
 */
export function getWechatQrCode(params: { scene: string; expire_seconds?: number }) {
    return createAxios({
        url: '/api/wechat/getQrCode',
        method: 'post',
        data: params,
    })
}

/**
 * 检查二维码登录状态
 */
export function checkWechatQrLogin(params: { scene: string }) {
    return createAxios({
        url: '/api/wechat/checkQrLogin',
        method: 'post',
        data: params,
    })
}

/**
 * 获取微信授权URL
 */
export function getWechatAuthUrl() {
    return createAxios({
        url: '/api/wechat/getAuthUrl',
        method: 'get',
    })
}

/**
 * 使用临时凭证登录
 */
export function loginByTempToken(params: { temp_token: string }) {
    return createAxios({
        url: '/api/wechat/loginByTempToken',
        method: 'post',
        data: params,
    })
}
